# -*- coding: utf-8 -*-

def classify(list,coefficient):
	copy_products = list[:]
	print(copy_products,"\n")

	# 把数据化成0-1
	column = []
	for p in range(len(copy_products[0])):
		column.append([x[p] for x in copy_products])

	for i in range(len(copy_products)):
		for j in range(len(copy_products[i])):
			copy_products[i][j] = (copy_products[i][j] - min(column[j])) / (max(column[j])-min(column[j]))


	# y 值
	
	yList = []
	for row in copy_products:
		yList.append(coefficient*sum(row))
		print("0-1: ", row)
	print()
	print("y:   ", yList)

	# score
	yList.sort()
	A = len(yList)//3
	B = len(yList)*2//3
	print("小于等于",A,"为A,","小于等于",B,"为B")


	score = yList[:]
	for i in range(len(yList)):
		if yList[i] <= A:
			score[i] = "A"
		elif yList[i] <= B:
			score[i] = "B"
		else:
			score[i] = "C"

	print(score,"\n")	
	






products = [[1,2,3,4,5],
			[6,7,8,9,10],
			[11,12,13,14,15],
			[16,17,18,19,20],
			[21,22,23,24,25]]

classify(products,1)




